/**
 * This class is a subclass of the Hand class, and are used to model a hand of Single.
 * It overrides getTopCard,isValid and getType method that it inherits from Hand class.
 *
 * @author Jiang Feiyu
 */
public class Single extends Hand{
    /**
     * Constructor for the Single type hand. Calls the constructor of Hand superclass.
     *
     * @param player Player who plays the hand
     * @param cards  List of card played by the player
     */

    public Single(CardGamePlayer player, CardList cards) {
        super(player,cards);
    }

    /**
     * a method for retrieving the top card of this hand.(overwrite)
     */
    public Card getTopCard() {
        return this.getCard(0);
    }

    /**
     * Checks whether the hand is a Single.
     */
    public boolean isValid() {
        if(this.size()==1) {
            return true;
        }
        return false;
    }

    /**
     * Returns type of string.
     */
    public String getType() {
        return "Single";
    }
}
